<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\SpecificationAttribute;

class SpecificationAttributeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $attributes = [
            [
                'key' => 'color',
                'name' => '颜色',
                'type' => 'color',
                'is_required' => true,
                'sort_order' => 1,
                'is_active' => true,
                'options' => [
                    '原色钛金属' => '#8B4513',
                    '蓝色钛金属' => '#4169E1',
                    '白色钛金属' => '#F5F5F5',
                    '黑色钛金属' => '#2F2F2F'
                ]
            ],
            [
                'key' => 'storage',
                'name' => '存储',
                'type' => 'select',
                'is_required' => true,
                'sort_order' => 2,
                'is_active' => true,
                'options' => ['128GB', '256GB', '512GB', '1TB']
            ],
            [
                'key' => 'size',
                'name' => '尺寸',
                'type' => 'select',
                'is_required' => false,
                'sort_order' => 3,
                'is_active' => true,
                'options' => ['6.1英寸', '6.7英寸', '11英寸', '12.9英寸']
            ],
            [
                'key' => 'memory',
                'name' => '内存',
                'type' => 'select',
                'is_required' => false,
                'sort_order' => 4,
                'is_active' => true,
                'options' => ['8GB', '16GB', '24GB', '32GB']
            ],
            [
                'key' => 'capacity',
                'name' => '容量',
                'type' => 'select',
                'is_required' => false,
                'sort_order' => 5,
                'is_active' => true,
                'options' => ['64GB', '128GB', '256GB', '512GB', '1TB']
            ],
            [
                'key' => 'model',
                'name' => '型号',
                'type' => 'select',
                'is_required' => false,
                'sort_order' => 6,
                'is_active' => true,
                'options' => ['标准版', 'Pro版', 'Max版', 'Ultra版']
            ],
            [
                'key' => 'version',
                'name' => '版本',
                'type' => 'select',
                'is_required' => false,
                'sort_order' => 7,
                'is_active' => true,
                'options' => ['Wi-Fi版', '蜂窝版', 'Wi-Fi+蜂窝版']
            ]
        ];

        foreach ($attributes as $attribute) {
            SpecificationAttribute::updateOrCreate(
                ['key' => $attribute['key']],
                $attribute
            );
        }
    }
}